package com.itheima.wemedia.feign;

import com.itheima.common.vo.ResultVo;
import com.itheima.wemedia.dto.WmNewsPageReqDto;
import com.itheima.wemedia.pojo.WmNews;
import com.itheima.wemedia.vo.WmNewsVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * @version 1.0
 * @description 说明
 * @package com.itheima.wemedia.feign
 */
@FeignClient(name = "leadnews-wemedia",contextId = "wmNewsFeign")
public interface WmNewsFeign {

    /**
     * 通过id查询文章信息
     * @param wmNewsId
     * @return
     */
    @GetMapping("/api/wmNews/{wmNewsId}")
    ResultVo<WmNews> getWmNewsById(@PathVariable(value = "wmNewsId") Long wmNewsId);

    /**
     * 更新自媒体文章
     * @param wmNews
     * @return
     */
    @PostMapping("/api/wmNews/update")
    ResultVo updateWmNews(@RequestBody WmNews wmNews);

    /**
     * 查询需要同步到文章
     * 自媒体文章同步到微服务
     * @param pageReqDto
     * @return
     */
    @PostMapping("/api/wmNews/list4ArticleSync")
    ResultVo<List<WmNewsVo>> list4ArticleSync(@RequestBody WmNewsPageReqDto pageReqDto);
}
